var EXPORTED_SYMBOLS = ["breadcrumbsDBConn"];

var BCFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);

const BCFilename = "breadCrumbs.sqlite";
BCFile.append(BCFilename);

var breadcrumbsDBConn;

if (Components.interfaces.nsPIPlacesDatabase != null) {
	breadcrumbsDBConn = Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection;
} else {
	var placesFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
	placesFile.append("places.sqlite");
	var storageService = Components.classes["@mozilla.org/storage/service;1"].getService(Components.interfaces.mozIStorageService);
	breadcrumbsDBConn = storageService.openDatabase(placesFile);
}

// Attach the Database
var attachStatementString = "ATTACH DATABASE ?1 AS breadcrumbs;";
var attachStatement = breadcrumbsDBConn.createStatement(attachStatementString);
attachStatement.bindUTF8StringParameter(0, BCFile.path);
attachStatement.execute();
attachStatement.finalize();

breadcrumbsDBConn.executeSimpleSQL("CREATE TABLE IF NOT EXISTS breadcrumbs.edgeLog ( row INTEGER PRIMARY KEY, destination TEXT, source TEXT, title TEXT, annotation TEXT, fav TEXT, permTitle TEXT, timeEnter DATETIME DEFAULT CURRENT_TIMESTAMP, linkType INTEGER, image TEXT, cords TEXT);");

